<?php
@include("connect.php");

//分页
$id = $_GET['id'];

// $id = 5;

$obj = [];


$sql = "select * from goodlist where id=$id";

// 默认只会转第一条数据
$res = mysqli_query($conn, $sql);
$arr = mysqli_fetch_array($res);
// 

$data = [];


if ($arr) {
    $data['id'] = $arr['id'];
    $data['title'] = $arr['title'];
    $data['img'] = $arr['img'];
    $data['price'] = $arr['price'];
    $data['type'] = $arr['type'];

    $obj['status'] = false;
    $obj['msg'] = '数据请求成功';
    $obj['data'] = $data;
} else {
    $obj['status'] = false;
    $obj['msg'] = '服务器错误';
}

echo (json_encode($obj, JSON_UNESCAPED_UNICODE));
